const mongoose = require("mongoose");

module.exports.login3 = async (thedata) => {
    return await mongoose.model("adminsModel").find(thedata);
}


module.exports.getadmins3 = async () => {
    
    // const data2 = await mongoose.model("adminsModel").find()
    // console.log(data2);
    return await mongoose.model("adminsModel").find()
}
module.exports.search3 = async (adminname) => {
    // console.log(adminname);
    const data = await mongoose.model("adminsModel")
    .find({adminname:adminname});
    return data
    
    
}

module.exports.updateOne3 = async ({ _id, adminname, password, state }) => {
    return await mongoose.model("adminsModel").updateOne({ _id }, { adminname, password, state })
}

module.exports.deleteOne3 = async function (adminId) {
    // async await
    const data = await mongoose.model("adminsModel").deleteOne(adminId);
    return data;
}

module.exports.addOne3 = async function (newadmin) {
    // async await
    const data = await mongoose.model("adminsModel").create(newadmin)
    return data;
}